<?php $frmFaculty = $this->frmFaculty;
$user_type = $this->user_type_id;
echo $user_type;
$cancel_url = $this->url(array('module'=>'faculty','controller'=>'index','action'=>''));
?>
<style>
dt{ display: none;}
</style>
<div class="row">
	<div class="col-lg-12">
		<div class="box" style="width: 95%; margin: 0 auto;">
			<header class="dark">
				<div class="icons"><i class="icon-ok"></i></div>
					<h5>បន្ថែមមហាវិទ្យាល័យ/Add More Faculty</h5>
                    <div class="toolbar">
                    	<ul class="nav">
							<li>
                            <div class="btn-group" style="padding: 10px;">
                            	<a class="accordion-toggle btn btn-xs minimize-box" data-toggle="collapse" href="#collapse2">
                                	<i class="icon-chevron-up"></i>
                                </a>
                                <button class="btn btn-xs btn-primary close-box"><i class="icon-group"></i></button>
                            </div>
                            </li>
                     	</ul>
                	</div>
          	</header>
			<div id="collapse2" class="body collapse in">
				<form class="form-horizontal" id="popup-validation" enctype="multipart/form-data" method="post">
                    <div style="float: left; text-align: left;" class="control-label col-lg-9">
                    	<?php if($user_type==1){
                    		echo "<div class='form-group'>
			                    	<label class='control-label col-lg-4'> សាខា / Branch : </label>
			                        <div class='col-lg-6'>";
                    			echo $frmFaculty->getElement('branch');
                    		echo "</div>
	               					</div>";
                    	}?>
<!--                     	<div class="form-group"> -->
<!-- 	                    	<label class="control-label col-lg-4"> សាខា / Branch : </label> -->
<!-- 	                        <div class="col-lg-6"> -->
	                        	<?php //echo $frmFaculty->getElement('branch');?>
<!-- 	                        </div> -->
<!-- 	               		</div> -->
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> មហាវិទ្យាល័យ / Faculty : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmFaculty->getElement('faculty');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ពិពណ៌នា / Description : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmFaculty->getElement('description');?>
	                        </div>
	               		</div>
	               		<div class="form-group">
	                    	<label class="control-label col-lg-4"> ស្ថានភាព / Status : </label>
	                        <div class="col-lg-6">
	                        	<?php echo $frmFaculty->getElement('status');?>
	                        </div>
	               		</div>
               		</div>
<!--                		<div class="form-group"> -->
<!--                			<label class="control-label col-lg-12" style="text-align:left"> ឈ្មោះទីតាំង  / Branch Name : </label> -->
<!--                		</div> -->
<!--                     <div class="col-lg-5"> -->
<!--                         <div class="form-group"> -->
<!--                             <div class="input-group"> -->
<!--                                 <input id="box1Filter" type="text" placeholder="Filter" class="form-control" /> -->
<!--                                 <span class="input-group-btn"> -->
<!--                                     <button id="box1Clear" class="btn btn-warning" type="button">x</button> -->
<!--                                 </span> -->
<!--                             </div> -->
<!--                         </div> -->
<!--                         <div class="form-group"> -->
	                        	<?php //echo $frmFaculty->getElement('branch');?>
<!--                             <hr> -->
<!--                             <div class="alert alert-block"> -->
<!--                                 <span id="box1Counter" class="countLabel"></span> -->
<!--                                 <select id="box1Storage" class="form-control"></select> -->
<!--                             </div> -->
<!--                         </div> -->
<!--                     </div> -->

<!--                     <div class="col-lg-2"> -->
<!--                         <div class="btn-group btn-group-vertical" style="white-space: normal;"> -->
<!--                             <button id="to2" type="button" class="btn btn-primary"> -->
<!--                                 <i class="icon-chevron-right"></i> -->
<!--                             </button> -->
<!--                             <button id="allTo2" type="button" class="btn btn-primary"> -->
<!--                                 <i class="icon-forward"></i> -->
<!--                             </button> -->
<!--                             <button id="allTo1" type="button" class="btn btn-danger"> -->
<!--                                 <i class="icon-backward"></i> -->
<!--                             </button> -->
<!--                             <button id="to1" type="button" class="btn btn-danger"> -->
<!--                                 <i class=" icon-chevron-left icon-white"></i> -->
<!--                             </button> -->
<!--                         </div> -->
<!--                     </div> -->

<!--                     <div class="col-lg-5"> -->
<!--                         <div class="form-group"> -->
<!--                             <div class="input-group"> -->
<!--                                 <input id="box2Filter" type="text" placeholder="Filter" class="form-control" /> -->
<!--                                 <span class="input-group-btn"> -->
<!--                                     <button id="box2Clear" class="btn btn-warning" type="button">x</button> -->
<!--                                 </span> -->
<!--                             </div> -->
<!--                         </div> -->
<!--                         <div class="form-group"> -->
                        	<?php //echo $frmFaculty->getElement('branch_select');?>
<!-- <!--                             <select id="box2View" multiple="multiple" class="form-control" size="8"></select> --> 
<!--                         </div> -->
<!--                         <hr /> -->

<!--                         <div class="alert alert-block"> -->
<!--                             <span id="box2Counter" class="countLabel"></span> -->
<!--                             <select id="box2Storage" name="branch_select" class="form-control"> </select> -->
<!--                         </div> -->
<!--                     </div> -->
                    <div class="form-group">
	                    	<label class="control-label col-lg-4">  </label>
	                        <div class="col-lg-4">
	                        	<button type="submit" id="save" name="save" class="btn btn-primary btn-grad"><i class="icon-save"> </i> រក្សាទុក</button>
	                        	<button type="submit" id="save_close" name="save_close" class="btn btn-primary btn-grad"><i class="icon-save"> </i> រក្សាទុក​​ និង​ ចាកចេញ</button>                        		
	                        	<a href="<?php echo $cancel_url; ?>"><button​ type="button" class="btn btn-primary btn-grad"><i class="icon-remove-sign"> </i> ចាកចេញ</button></a>
	                        </div>
	               	</div>
           	 	</form>
           	</div>
		</div>
	</div>
</div>
<script>
<?php $getfillter_add =  $this->url(array('module'=>'users','controller'=>'index','action'=>'getfillteradd')); ?>
function getfillterUserType(){
	username = $('#username').val();
	$.ajax({
		url:"<?php echo $getfillter_add;?>",
		type:"post",
		data:{'username':username},
		success: function(data){	
			user_type = $.parseJSON(data);					
			if(user_type!=null){
				 for (var index = 1; index <= username.length; index++) {
					 alert(username[index-1]['username']+" is Already Exist!!");
				}
				 document.getElementById("username").style.borderColor="#FF0000";
				 document.getElementById("username").style.color="#FF0000";
				 document.getElementById("save").setAttribute('disabled', 'disabled');
				 document.getElementById("save_close").setAttribute('disabled', 'disabled');
			}else{
				document.getElementById("save").disabled = false;
				document.getElementById("save_close").disabled = false;
				document.getElementById("user_type").style.borderColor="";
				document.getElementById("user_type").style.color="#000";
			}
		},
		error:function(){
		}
	});
}
</script>